#!/usr/bin python
# -*- coding: utf-8 -*-
# @Time    : 2024/6/18 9:49
# @Author  : hhr
from supervision_inspection.models import *


class SwitchData():
    def SearchPerformanceAllocation(self, search_year, search_month):
        objs = PerformanceAllocation.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="16" style="width: 1850px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月绩效工资分配表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">正01表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="17" style="width: 1950px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td rowspan="2" style="width: 200px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科室</td>
                <td rowspan="2" style="width: 200px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科室编号</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科室负责人</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">工号</td>
                <td colspan="2" style="width: 200px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;font-size: 12px;">科室绩效</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科室绩效合计</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科主任科室绩效</td>
                <td colspan="7" style="width: 750px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;font-size: 12px;">专项绩效</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">专项绩效合计</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">应发绩效总计</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">工作量绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">综合考核绩效</td>
                <td style="width: 150px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">科主任管理绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">夜班绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">会诊绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">门诊专项绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">医共体绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">其他单项绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">人才储备绩效</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 200px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.department_name}</td>
                    <td style="width: 200px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.department_code}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.department_director}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.workload}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.synthesize}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.department_total}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.director_performance}</td>
                    <td style="width: 150px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.director_control_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.night_shift_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.consultation_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.outpatient_special_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.medical_community}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.other_single}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.talent_reserve}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.special_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.expected_performance}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationClinical(self, search_year, search_month):
        objs = PerformanceAllocationClinical.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1320px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月科室绩效明细表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附01表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="13" style="width: 1420px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室负责人</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工作量绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">新技术/新业务绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">单位体检绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">卒中/胸痛绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">疫情防控</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">高考体检</td>
                <td style="width: 120px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">新入职人员人才储备绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护理文书奖惩</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室/纠纷跑账</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室绩效合计</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_director}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.workload}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.new_business}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.unit_checkup}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.apoplexy_stethalgia}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.prevention_control}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.college_control}</td>
                    <td style="width: 120px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.talent_reserve}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.nursing_documents}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.departmental_disputes}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_total}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationTalentReserve(self, search_year, search_month):
        objs = PerformanceAllocationTalentReserve.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1320px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月人才储备绩效明细表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附11表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="13" style="width: 1420px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">所属科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">姓名</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">职称级别</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">技术职称</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">发放标准（元）</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">本月应发（元）</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">请假天数</td>
                <td style="width: 120px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">开始发放时间</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">终止时间</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_director}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.title_level}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.technical_title}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.distribution_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.due_this_month}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.leave_days}</td>
                    <td style="width: 120px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.start_time}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.end_time}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationOtherSingleItems(self, search_year, search_month):
        objs = PerformanceAllocationOtherSingleItems.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="9" style="width: 1100px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月其他单项绩效明细表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附08表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="8" style="width: 900px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="2" style="width: 300px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">姓名</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">元旦</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">春节</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">合计</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">天数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">金额</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.news_day}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.spring_festival}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.total}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.days}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.money}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationMedicalCommunity(self, search_year, search_month):
        objs = PerformanceAllocationMedicalCommunity.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="3" style="width: 500px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月医共体绩效明细表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附07表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="4" style="width: 600px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">绩效合计</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.total}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationOutpatientSpecialty(self, search_year, search_month):
        objs = PerformanceAllocationOutpatientSpecialty.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="7" style="width: 800px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月门诊专项绩效明细表</strong></td>
                <td style="width: 200px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附06表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="5" style="width: 600px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="3" style="width: 400px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医生</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">总人次</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">总金额</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">绩效合计</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.doctor}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.person_time}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.money}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.total_performance}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationConsultationPerformance(self, search_year, search_month):
        objs = PerformanceAllocationConsultationPerformance.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="6" style="width: 700px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月门诊专项绩效明细表</strong></td>
                <td style="width: 200px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附05表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="4" style="width: 500px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="3" style="width: 400px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">归属科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医生</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">数量</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">绩效金额</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.ascription_department}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.doctor}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.quantity}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.performance_amount}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationNightShiftPerformance(self, search_year, search_month):
        objs = PerformanceAllocationNightShiftPerformance.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="15" style="width: 1800px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月夜班绩效明细表</strong></td>
                <td style="width: 200px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附04表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1550px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="4" style="width: 450px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td rowspan="2" style="width: 150px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室类型</td>
                <td rowspan="2" style="width: 150px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">归属科室</td>
                <td rowspan="2" style="width: 150px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">归属科室编号</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">每日固定人数</td>
                <td colspan="4" style="width: 400px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护理人员</td>
                <td colspan="2" style="width: 300px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医生及其他整夜班人员</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">月天数</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">其中：</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">浮动夜班费</td>
                <td rowspan="2" style="width: 200px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">实发夜班绩效合计</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">上夜班人数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">上夜班标准</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">下夜班人数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">下夜班标准</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">整夜班人数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">整夜班标准</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">劳务派遣人员夜班</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_category}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.ascription_department}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.ascription_dep_code}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.fixed_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.night_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.night_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.end_night_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.end_night_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.number_of_overnight_shifts}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.full_night_shift_standard}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.month_days}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.labor_dispatch}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.floating_fee}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.actual_occurrence}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationDirectorPerformance(self, search_year, search_month):
        objs = PerformanceAllocationDirectorPerformance.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1500px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月管理绩效明细表</strong></td>
                <td colspan="2" style="width: 300px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附03表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1550px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="2" style="width: 250px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">所在科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">姓名</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">行政职务</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">行政职务任职时间</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室类型</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">质量考核分数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">管理绩效标准</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">出勤天数</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">年度考核扣罚金额</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">季度考核扣罚金额</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">管理绩效合计</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">考核系数</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.position}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.duration_employment}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_category}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.assessment_score}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.management_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.attendance_days}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.deduction_amount}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.quarterly_assessment}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.management_performance}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.assessment_coefficient}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationComprehensiveTargetPerformance(self, search_year, search_month, department_type):
        objs = PerformanceAllocationComprehensiveTargetPerformance.objects.filter(years=search_year, month=search_month, department_type=department_type)
        if department_type == '1':
            data_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td colspan="10" style="width: 1500px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月综合目标绩效（临床科室）明细表</strong></td>
                    <td colspan="3" style="width: 450px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附02表</strong></td>
                </tr>
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td colspan="9" style="width: 1400px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                    <td colspan="4" style="width: 550px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
                </tr>
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编码</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">人数</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医疗质量维度（55分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护理质量维度（15分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医德医风维度（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医保管理（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科研教学（10分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">病案质量（10分）</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">得分</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">综合目标绩效</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科主任考核得分</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护士长考核得分</td>
                </tr>
            """
        else:
            data_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td colspan="10" style="width: 1500px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月综合目标绩效（医技及其他科室）明细表</strong></td>
                    <td colspan="3" style="width: 450px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附02表</strong></td>
                </tr>
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td colspan="9" style="width: 1400px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                    <td colspan="4" style="width: 550px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
                </tr>
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编码</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">人数</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医疗质量维度（60分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护理质量维度（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医德医风维度（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医保管理（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科研教学（10分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">病案质量（15分）</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">得分</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">综合目标绩效</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科主任考核得分</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护士长考核得分</td>
                </tr>
            """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.people_number}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.quality_dimension}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.nursing_quality}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.medical_ethics}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.medical_insurance}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.research_teaching}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.record_quality}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.score}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.target_performance}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_score}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.nurse_score}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationNewTalentReserve(self, search_year, search_month):
        objs = PerformanceAllocationNewTalentReserve.objects.filter(years=search_year, month=search_month)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="11" style="width: 1200px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月新入职人才储备绩效明细表</strong></td>
                <td colspan="2" style="width: 300px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附02表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="13" style="width: 1500px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">所属科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">姓名</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">职称级别</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">技术职称</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">发放标准（元）</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">本月应发（元）</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">扣减天数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">开始发放时间</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">终止时间</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">上班天数</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.ascription_department}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.djob_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.title_level}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.technical_title}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.distribution_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.due_this_month}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.leave_days}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.start_time}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.end_time}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.working_days}</td>
                </tr>
            """
            data_str += one_str
        return data_str


class SwitchDataCopy():
    def SearchPerformanceAllocation(self, search_year, search_month, department_code):
        objs = PerformanceAllocation.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="16" style="width: 1850px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月绩效工资分配表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">正01表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="17" style="width: 1950px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td rowspan="2" style="width: 200px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科室</td>
                <td rowspan="2" style="width: 200px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科室编号</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科室负责人</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">工号</td>
                <td colspan="2" style="width: 200px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;font-size: 12px;">科室绩效</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科室绩效合计</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">科主任科室绩效</td>
                <td colspan="7" style="width: 750px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;font-size: 12px;">专项绩效</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">专项绩效合计</td>
                <td rowspan="2" style="width: 100px;height: 60px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 60px;font-size: 12px;">应发绩效总计</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">工作量绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">综合考核绩效</td>
                <td style="width: 150px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">科主任管理绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">夜班绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">会诊绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">门诊专项绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">医共体绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">其他单项绩效</td>
                <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">人才储备绩效</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 200px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.department_name}</td>
                    <td style="width: 200px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.department_code}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.department_director}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.workload}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.synthesize}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.department_total}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.director_performance}</td>
                    <td style="width: 150px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.director_control_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.night_shift_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.consultation_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.outpatient_special_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.medical_community}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.other_single}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.talent_reserve}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.special_performance}</td>
                    <td style="width: 100px;height: 30px;text-align: center;border-right: #cfcfcf solid 1px;line-height: 30px;">{obj.expected_performance}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationClinical(self, search_year, search_month, department_code):
        objs = PerformanceAllocationClinical.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1320px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月科室绩效明细表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附01表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="13" style="width: 1420px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室负责人</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工作量绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">新技术/新业务绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">单位体检绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">卒中/胸痛绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">疫情防控</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">高考体检</td>
                <td style="width: 120px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">新入职人员人才储备绩效</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护理文书奖惩</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室/纠纷跑账</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室绩效合计</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_director}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.workload}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.new_business}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.unit_checkup}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.apoplexy_stethalgia}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.prevention_control}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.college_control}</td>
                    <td style="width: 120px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.talent_reserve}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.nursing_documents}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.departmental_disputes}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_total}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationTalentReserve(self, search_year, search_month, department_code):
        objs = PerformanceAllocationTalentReserve.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1320px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月人才储备绩效明细表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附11表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="13" style="width: 1420px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">所属科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">姓名</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">职称级别</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">技术职称</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">发放标准（元）</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">本月应发（元）</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">请假天数</td>
                <td style="width: 120px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">开始发放时间</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">终止时间</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_director}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.title_level}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.technical_title}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.distribution_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.due_this_month}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.leave_days}</td>
                    <td style="width: 120px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.start_time}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.end_time}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationOtherSingleItems(self, search_year, search_month, department_code):
        objs = PerformanceAllocationOtherSingleItems.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="9" style="width: 1100px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月其他单项绩效明细表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附08表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="8" style="width: 900px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="2" style="width: 300px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">姓名</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">元旦</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">春节</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">合计</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">天数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">金额</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.news_day}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.spring_festival}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.total}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.days}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.money}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationMedicalCommunity(self, search_year, search_month, department_code):
        objs = PerformanceAllocationMedicalCommunity.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="3" style="width: 500px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月医共体绩效明细表</strong></td>
                <td style="width: 100px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附07表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="4" style="width: 600px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">绩效合计</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.total}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationOutpatientSpecialty(self, search_year, search_month, department_code):
        objs = PerformanceAllocationOutpatientSpecialty.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="7" style="width: 800px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月门诊专项绩效明细表</strong></td>
                <td style="width: 200px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附06表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="5" style="width: 600px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="3" style="width: 400px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医生</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">总人次</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">总金额</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">绩效合计</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.doctor}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.person_time}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.money}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.total_performance}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationConsultationPerformance(self, search_year, search_month, department_code):
        objs = PerformanceAllocationConsultationPerformance.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="6" style="width: 700px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月门诊专项绩效明细表</strong></td>
                <td style="width: 200px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附05表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="4" style="width: 500px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="3" style="width: 400px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">归属科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医生</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">数量</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">绩效金额</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.ascription_department}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.doctor}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.quantity}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.performance_amount}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationNightShiftPerformance(self, search_year, search_month, department_code):
        objs = PerformanceAllocationNightShiftPerformance.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="15" style="width: 1800px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月夜班绩效明细表</strong></td>
                <td style="width: 200px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附04表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1550px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="4" style="width: 450px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td rowspan="2" style="width: 150px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室类型</td>
                <td rowspan="2" style="width: 150px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">归属科室</td>
                <td rowspan="2" style="width: 150px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">归属科室编号</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">每日固定人数</td>
                <td colspan="4" style="width: 400px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护理人员</td>
                <td colspan="2" style="width: 300px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医生及其他整夜班人员</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">月天数</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">其中：</td>
                <td rowspan="2" style="width: 100px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">浮动夜班费</td>
                <td rowspan="2" style="width: 200px;height: 60px;line-height: 60px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">实发夜班绩效合计</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">上夜班人数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">上夜班标准</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">下夜班人数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">下夜班标准</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">整夜班人数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">整夜班标准</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">劳务派遣人员夜班</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_category}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.ascription_department}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.ascription_dep_code}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.fixed_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.night_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.night_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.end_night_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.end_night_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.number_of_overnight_shifts}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.full_night_shift_standard}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.month_days}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.labor_dispatch}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.floating_fee}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.actual_occurrence}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationDirectorPerformance(self, search_year, search_month, department_code):
        objs = PerformanceAllocationDirectorPerformance.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1500px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月管理绩效明细表</strong></td>
                <td colspan="2" style="width: 300px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附03表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="12" style="width: 1550px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                <td colspan="2" style="width: 250px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">所在科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">姓名</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">行政职务</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">行政职务任职时间</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室类型</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">质量考核分数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">管理绩效标准</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">出勤天数</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">年度考核扣罚金额</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">季度考核扣罚金额</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">管理绩效合计</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">考核系数</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.job_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.position}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.duration_employment}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_category}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.assessment_score}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.management_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.attendance_days}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.deduction_amount}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.quarterly_assessment}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.management_performance}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.assessment_coefficient}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationComprehensiveTargetPerformance(self, search_year, search_month, department_type, department_code):
        objs = PerformanceAllocationComprehensiveTargetPerformance.objects.filter(years=search_year, month=search_month, department_type=department_type, department_code=department_code)
        if department_type == '1':
            data_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td colspan="10" style="width: 1500px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月综合目标绩效（临床科室）明细表</strong></td>
                    <td colspan="3" style="width: 450px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附02表</strong></td>
                </tr>
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td colspan="9" style="width: 1400px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                    <td colspan="4" style="width: 550px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
                </tr>
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编码</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">人数</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医疗质量维度（55分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护理质量维度（15分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医德医风维度（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医保管理（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科研教学（10分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">病案质量（10分）</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">得分</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">综合目标绩效</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科主任考核得分</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护士长考核得分</td>
                </tr>
            """
        else:
            data_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td colspan="10" style="width: 1500px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月综合目标绩效（医技及其他科室）明细表</strong></td>
                    <td colspan="3" style="width: 450px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附02表</strong></td>
                </tr>
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td colspan="9" style="width: 1400px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
                    <td colspan="4" style="width: 550px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：元</td>
                </tr>
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编码</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">人数</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医疗质量维度（60分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护理质量维度（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医德医风维度（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">医保管理（5分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科研教学（10分）</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">病案质量（15分）</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">得分</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">综合目标绩效</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科主任考核得分</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">护士长考核得分</td>
                </tr>
            """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_name}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.people_number}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.quality_dimension}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.nursing_quality}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.medical_ethics}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.medical_insurance}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.research_teaching}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.record_quality}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.score}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.target_performance}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_score}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.nurse_score}</td>
                </tr>
            """
            data_str += one_str
        return data_str

    def SearchPerformanceAllocationNewTalentReserve(self, search_year, search_month, department_code):
        objs = PerformanceAllocationNewTalentReserve.objects.filter(years=search_year, month=search_month, department_code=department_code)
        data_str = f"""
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="11" style="width: 1200px;height: 40px;line-height: 40px;text-align: center;"><strong style="font-size: 18px;">{search_year}年{search_month}月新入职人才储备绩效明细表</strong></td>
                <td colspan="2" style="width: 300px;height: 40px;line-height: 40px;text-align: center;border-left: #cfcfcf solid 1px;"><strong style="font-size: 18px;">附02表</strong></td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td colspan="13" style="width: 1500px;height: 30px;line-height: 30px;text-align: left;padding-left: 15px;font-size: 12px;">单位：协和京山医院</td>
            </tr>
            <tr style="border-bottom: #cfcfcf solid 1px;">
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">科室编号</td>
                <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">所属科室</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">工号</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">姓名</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">职称级别</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">技术职称</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">发放标准（元）</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">本月应发（元）</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">扣减天数</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">开始发放时间</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">终止时间</td>
                <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">备注</td>
                <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">上班天数</td>
            </tr>
        """
        for obj in objs:
            one_str = f"""
                <tr style="border-bottom: #cfcfcf solid 1px;">
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.department_code}</td>
                    <td style="width: 150px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.ascription_department}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.djob_number}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.name}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.title_level}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.technical_title}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.distribution_standards}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.due_this_month}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.leave_days}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.start_time}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.end_time}</td>
                    <td style="width: 200px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.node}</td>
                    <td style="width: 100px;height: 30px;line-height: 30px;text-align: center;border-right: #cfcfcf solid 1px;font-size: 12px;">{obj.working_days}</td>
                </tr>
            """
            data_str += one_str
        return data_str